<%@ page language="java" pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
<%@ include file="/WEB-INF/views/common.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>eduProcess</title>
<link rel="stylesheet" type="text/css" href="/resources/css/web.css" />
<script src="/resources/js/jquery.min.js" type="text/javascript"></script>
<script src="/resources/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="/resources/js/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(
		function(){
			var resetPasswdValidator = $("#resetPasswdForm").validate({
				submitHandler: function(form) {
					$("#submitLine").hide();
					$("#indicatorLine").show();
					
					$(form).ajaxSubmit({
						type:"post",
						datatype:"json",
						url: "/json/sendresetspasswdemail",
						success: function(data){
							if(data.result){
								alert('邮件已发送，请注意查收。');
								window.location.replace("/help");
							}else{
								var errMsg = '';
								$.each(data.errors, function(key, value){
									errMsg += key+":"+value + "\n";
								});
								alert(errMsg);
								resetPasswdValidator.showErrors(data.errors);
							}
						},
						error: function(){
							$("#submitLine").show();
							$("#indicatorLine").hide();
							alert("服务器处理异常");
						}
					});
				},
				rules:{
					"email": {
						required:	true,
						email:		true
					},
					"verifyCode":{
						required:	true
					}
				},
				messages: {
					"email": {
						required:	"电子邮件 必须填写",
						email:		"请输入正确的电子邮件格式"
					},
					"verifyCode":{
						required:	"验证码 必须填写"
					}
				},
				errorElement: "div",
				errorPlacement: function(error, element) {
					error.appendTo(element.parent());
					error.addClass('errormsg');
				},
				
				onkeyup: false
			});
		}
	);
</script>
</head>
<body>
<div class="tmenu">
	<div class="tm_logo">
		<ul>
			<li class="menuli">
				<a href="#" class="tm_logo_txt">重新设置密码</a>
			</li>
		</ul>
	</div>
	<div class="tm_pro">
		<ul>
			<li>
				<a href="/login" class="tm_pro_name">登录</a>
			</li>
		</ul>
	</div>
</div>
<div class="content" style="min-height:300px;padding-left:40px;margin-bottom:50px;">
	<div id="signuparea">
		<div style="padding-top:20px;padding-bottom:20px;">
			输入你的电子邮件，系统会发送密码重置链接至该信箱。
		</div>
		<form id="resetPasswdForm" name="resetPasswdForm" method="post">
		<div>
			<div>
				<div class="fieldtitle"><label>电子邮件(登录ID)</label></div>
				<div><input type="email" id="email" name="email" value="" maxlength="128"/></div>

				<div class="fieldtitle"><label>验证码</label> <a href="javascript:void(0)" id="refreshSignupVerification"><span style="font-size:90%">[点击获取新的字符]</span></a></div>
				<div><input type="text" id="verifyCode" name="verifyCode" value=""/></div>
				<div>
					<img src="/verification" id="signupVerification"/>
				</div>
				<div id="submitLine"><input type="submit" value="获取重置链接" /></div>
				<div id="indicatorLine" style="display:none;"><img src="/resources/image/progressindicator.gif" align="absmiddle"/> 提交中...</div>
			</div>
		</div>
		</form>
	</div>

</div>
<div style="padding-top:0!important;bottom:0;right:0px;width:100%;margin-top:-31px;max-height:31px;border-top:1px solid #ccc;font-size:80%;">
<ul style="padding-left:20px;">
	<li class="foot_copy_li"><span class="foot_span">&copy; 2013 eduProcess</span></li>
	<li class="foot_li"><span class="foot_span">使用帮助</span></li>
	<li class="foot_li"><span class="foot_span">服务条款</span></li>
	<li class="foot_li"><span class="foot_span">隐私声明</span></li>
</ul>
</div>
</body>
</html>